package com.nuoniu.sibanyun.service.po.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nuoniu.sibanyun.entity.po.VRoRequisitionOrderDetail;
import com.nuoniu.sibanyun.mapper.po.VRoRequisitionOrderDetailMapper;
import com.nuoniu.sibanyun.service.po.IVRoRequisitionOrderDetailService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 请购单明细表 服务实现类
 * </p>
 *
 * @author baiqiang
 * @since 2020-11-17
 */
@Service
public class VRoRequisitionOrderDetailServiceImpl extends ServiceImpl<VRoRequisitionOrderDetailMapper, VRoRequisitionOrderDetail> implements IVRoRequisitionOrderDetailService {

    @Override
    public void removeByOrderId(Long id) {
        baseMapper.removeByOrderId(id);
    }

    @Override
    public List<VRoRequisitionOrderDetail> getOrderDetails(Long orderId) {
        UserInfo userInfo = UserThreadLocal.get();
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_id",userInfo.getCompanyId());
        queryWrapper.eq("order_id",orderId);
        List<VRoRequisitionOrderDetail> list = list(queryWrapper);
        return list;
    }
}
